//
//  LiveListSignInView.m
//  YouinRTCDemo
//
//  Created by 潘欣 on 2025/8/13.
//

#import "LiveListSignInView.h"
@interface LiveListSignInView ()
@end

@implementation LiveListSignInView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        UIButton *signInButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [signInButton setTitle:@"发起签到" forState:UIControlStateNormal];
        [signInButton setTitleColor:RYColorForHex(@"#0C78FF") forState:UIControlStateNormal];
        signInButton.titleLabel.font = [UIFont systemFontOfSize:18];
        signInButton.tag = 200;
        [signInButton addTarget:self action:@selector(signInListBtnActions:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:signInButton];
        
        [signInButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.mas_equalTo(self);
            make.height.offset(60);
        }];
        
        UILabel *lineLabel = [[UILabel alloc] init];
        lineLabel.backgroundColor = RYColorForHex(@"#E5E5E5");
        [self addSubview:lineLabel];
        [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(self);
            make.bottom.mas_equalTo(signInButton.mas_bottom).offset(1);
            make.height.offset(1);
        }];
        
        UIButton *signInListBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [signInListBtn setTitle:@"签到管理" forState:UIControlStateNormal];
        signInListBtn.tag = 300;
        [signInListBtn setTitleColor:RYColorForHex(@"#383838") forState:UIControlStateNormal];
        signInListBtn.titleLabel.font = [UIFont systemFontOfSize:18];
        [signInListBtn addTarget:self action:@selector(signInListBtnActions:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:signInListBtn];
        
        [signInListBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(self);
            make.top.mas_equalTo(lineLabel.mas_bottom);
            make.height.offset(60);
        }];
        
        UILabel *lineLabel1 = [[UILabel alloc] init];
        lineLabel1.backgroundColor = RYColorForHex(@"#E5E5E5");
        [self addSubview:lineLabel1];
        [lineLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(self);
            make.bottom.mas_equalTo(signInListBtn.mas_bottom).offset(1);
            make.height.offset(1);
        }];
        
        
        UIButton *cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
        [cancleBtn setTitleColor:RYColorForHex(@"#383838") forState:UIControlStateNormal];
        cancleBtn.titleLabel.font = [UIFont systemFontOfSize:18];
        [cancleBtn addTarget:self action:@selector(cancleBtnActions) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:cancleBtn];
        
        [cancleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.mas_equalTo(self);
            make.top.mas_equalTo(lineLabel1.mas_bottom);
            make.height.offset(60);
        }];
    }
    return self;
}

- (void)signInListBtnActions:(UIButton *)sender
{
    [self hideView];
    if ([self.delegate respondsToSelector:@selector(LiveSignActions:)]) {
        [self.delegate LiveSignActions:sender];
    }
}

 - (void)cancleBtnActions
{
    [self hideView];
}

@end
